package ControllerLayer;
import java.util.ArrayList;
import ContainerLayer.*;

/**
 * Write a description of class SalesmanController here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class SalesmanController
{
    // instance variables - replace the example below with your own
    private SalesmanContainer smCon;
    private static SalesmanController instance;
    private long id;

    /**
     * Constructor for objects of class SalesmanController
     */
    private SalesmanController()
    {
        // initialise instance variables       
        this.id = 0;
        smCon = SalesmanContainer.getInstance();
    }

    public static SalesmanController getInstance()
    {
        if(instance == null)
        {
            instance = new SalesmanController();
        }
        return instance;
    }

    public long getID()
    {
        return id;
    }
    
    public int getSize()
    {
        return smCon.getSizeSalesman();
    }

    public void createSalesman(String name, String address, String mail, int phoneNo)
    {
        id++;
        Salesman sm = new Salesman(id, name, address, mail, phoneNo);
        smCon.addSalesman(sm);
    }

    public Salesman readSalesman(long id)
    {     
        return smCon.readSalesman(id);        
    }
    
    public void updateSalesman(long id, String name, String address, String mail, int phoneNo)
    {
        smCon.updateSalesman(id, name, address, mail, phoneNo);
    }
    
    public void deleteSalesman(long id)
    {
        smCon.deleteSalesman(id);
    }
    
    public void getSizeOfSalesman(long id)
    {
        smCon.getSizeSalesman();
    }
    
    public void printOutSalesmanID(long id)
    {
        smCon.printOutSalesmanID(id);
    }
    
    public void printOutAllSalesman()
    {
        smCon.printOutAllSalesmen();
    }
    

}
